package spacecraft;

import java.awt.Rectangle;

import markgame2d.engine.MarkGame;
import markgame2d.engine.MarkSprite;
import markgame2d.engine.interfaces.Collideable;
import markgame2d.engine.interfaces.Updateable;
import markgame2d.engine.mover.MarkConstantMoverByKeyboard;
import markgame2d.engine.mover.MarkLimitMover;
import markgame2d.engine.mover.MarkMover;

public class Craft extends MarkSprite implements Collideable, Updateable{

	SpaceCraft game;
	
	MarkMover moverByKeyboard;
	MarkMover moverScreenLimit;
	
	public Craft(float x, float y) {
		super(x, y, MarkGame.loadImage(GameScreen.CRAFT_FILE));
		game = SpaceCraft.getInstance();
		makeTransparendByCornerColor();
		
		moverByKeyboard = new MarkConstantMoverByKeyboard(this,
				GameScreen.CRAFT_VEL,
				GameScreen.LEFT_KEY,
				GameScreen.RIGHT_KEY,
				GameScreen.UP_KEY,
				GameScreen.DOWN_KEY, 
				game.getKeys());
		moverScreenLimit = new MarkLimitMover(this, new Rectangle(SpaceCraft.WIDTH, SpaceCraft.HEIGHT));
	}
	
	public void update(float time) {
		moverByKeyboard.move(time);
		moverScreenLimit.move(time);
	}
	
	public void onColide(Collideable other) {
		
	}
	
}
